package com.shunhao.widgets.custom

import android.content.Context
import android.util.AttributeSet
import android.widget.GridView

/**
 * @author 康贵阳
 */
class CustomGridView : GridView {

    constructor(context: Context?) : super(context)

    constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs)

    constructor(context: Context?, attrs: AttributeSet?, defStyle: Int) : super(
        context,
        attrs,
        defStyle
    )

    public override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
        val expandSpec = MeasureSpec.makeMeasureSpec(Int.MAX_VALUE shr 2, MeasureSpec.AT_MOST)
        try {
            // 充满整个屏幕
            super.onMeasure(widthMeasureSpec, expandSpec)
        } catch (e: Exception) {
        }
    }
}